package com.example.friendfindertwo.adapter;

import java.util.List;
import com.example.friendfindertwo.R;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class FriendListAdapter extends BaseAdapter{
	
	private String[] mfriendRequests;
	private Context ctx;
	
	public FriendListAdapter(Context context, String[] result){
		mfriendRequests = result;
		ctx = context;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return mfriendRequests.length;
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View v;
		
		if(convertView == null){
			v = View.inflate(ctx, R.layout.friend_list_single, null);
		} else {
			v = convertView;
		}
		
		TextView friend = (TextView) v.findViewById(R.id.friendList);
		friend.setText(mfriendRequests[position].toString());
		
		return v;
	}

}
